package com.redhipps.hips.client.command;

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.redhipps.hips.client.model.DoctorConstraint;

@Deprecated
public class CreateDoctorConstraintsCommand extends HipsCommand<DoctorConstraint> {

  @Override
  public void execute(final AsyncCallback<DoctorConstraint> callback) {
//    final WriterMultiCallback writeConstraintsCallback = new WriterMultiCallback() {
//      public void onFailure(Throwable caught) {
//        GWT.log("Write constraints failed", caught);
//        callback.onFailure(caught);
//      }
//      public void onSuccess(List<SerializedModel> result) {
//        GWT.log("Create doctor constraints successful. " +
//            "Wrote " + result.size() + " constraints.", null);
//        callback.onSuccess(result.get(0));  // TODO Simplify callback
//      }
//    };
//    createLocalConstraints(context, context.schedule(), writeConstraintsCallback);
  }

//  public void createLocalConstraints(
//      final Context context, final SerializedModel schedule, final WriterMultiCallback callback) {
//    ReaderCallback readerCallback = new ReaderCallback() {
//      public void onFailure(Throwable caught) {
//        callback.onFailure(caught);
//      }
//      public void onSuccess(List<SerializedModel> doctors) {
//        List<SerializedModel> localConstraints = new ArrayList<SerializedModel>(doctors.size());
//        for (SerializedModel doc : doctors) {
//          SerializedModel constraint = DoctorConstraints.create(doc, schedule);
//          localConstraints.add(constraint);
//        }
//        doctorConstraintWriter.write(localConstraints, callback);
//      }
//    };
//    doctorReader.read(context, readerCallback);
//  }
}
